package com.tinyblog.ajax;

public class ExtendString {
	/**
	 * ��������ַ���ISO8859-1����
	 * @param str
	 * @return
	 */
	public static String formDecode(String str) {
		if(str == null) return null;
		str = str.trim();
		try {
			String temp = new String(str.getBytes("ISO8859-1"));
			return temp;
		}
		catch (Exception e) {
			return str;
		}
	}
	/**
	 * ��������ַ���UTF-8����
	 * @param str
	 * @return
	 */
	public static String decodeToUtf8(String str) {
		if(str == null) return null;
		str = str.trim();
		try {
			String temp = new String(str.getBytes("ISO8859-1"),"UTF-8");
			return temp;
		}catch(Exception ex) {
			return str;
		}
	}
}
